package com.zl.tby.screen.vo.mountains;

import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 护林员信息
 * @author changpeng
 * @version 1.0
 * @since 2024/10/23 22:49
 */
@Data
public class TbyMountainsPerson {
    private Long personId;
    private String realName;
    private Integer sex;
    private String sexValue;
    private String phone;
    private Integer isOnline;
    private String isOnlineValue;
    private BigDecimal longitude;
    private BigDecimal latitude;
    private Date lastTime;
    private Long lastTimeLong;

    public static void convert(List<TbyMountainsPerson> dataList) {
        for (TbyMountainsPerson entity : dataList) {
            if (entity.getSex() != null && entity.getSex().compareTo(1) == 0) {
                entity.setSexValue("女");
            } else if (entity.getSex() != null && entity.getSex().compareTo(2) == 0) {
                entity.setSexValue("男");
            } else {
                entity.setSexValue("未知");
            }
            if (entity.getLastTime() != null) {
                entity.setLastTimeLong(entity.getLastTime().getTime());
            }
            /*if (entity.getIsOnline() != null && entity.getIsOnline().compareTo(1) == 0) {
                entity.setIsOnlineValue("在线");
            } else {
                entity.setIsOnlineValue("离线");
            }*/
        }
    }
}
